package com.example.huhaichao.music.util;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

/**
 * Created by huhaichao on 2017/5/1.
 */

public class MusicUtils {
    public static ArrayList<String> aMusicList = new ArrayList<String>();// 存放全部音乐
    public static ArrayList<String> mMusicList = new ArrayList<String>();//存放喜爱音乐
    public static ArrayList<String> sMusicList = new ArrayList<String>();//存放搜索音乐
    // 获取全部音乐
    public static void initMusicList(List<String> list) {
        aMusicList.clear();
        aMusicList.addAll(removeDuplicate(list));
    }

    //获取喜爱音乐
    public static void initMusicList2(List<String> list) {
        // 获取歌曲列表
        mMusicList.clear();
        mMusicList.addAll(removeDuplicate(list));
    }

    //获取搜索音乐
    public static void initMusicList3(List<String> list) {
        // 获取歌曲列表
        sMusicList.clear();
        sMusicList.addAll(removeDuplicate(list));
    }

    //去除重复数据
    public static List<String> removeDuplicate(List<String> list) {
        HashSet set = new HashSet<String>();
        set.addAll(list);
        list.clear();
        list.addAll(set);
        return list;
    }
}
